In many information processing applications, a server application running on a host or server computer in a distributed network provides processing services or functions for client applications running on terminal or workstation computers of the network which are operated by a multitude of users. Common examples of such server applications include software for processing class registrations at a university, travel reservations, money transfers and other services at a bank, and sales at a business. In these examples, the processing services provided by the server application may update databases of class schedules, hotel reservations, account balances, order shipments, payments, or inventory for actions initiated by the individual users at their respective stations.
Because these server applications service a large number of users, the server applications must be programmed to deal with problems of concurrent shared access by multiple users. Shared access by multiple users create a number of well-known problems in correctly synchronizing updates by the users to durable data, isolating processing of one user from that of another, etc. These shared access problems are similar to those faced by users of a joint checking account when one user fails to notify the other of changes to the account balance before a check is written, possibly resulting in an overdraft. For example, a server application for an on-line bookstore faces a shared access problem where two customers concurrently place an order for the same book, and there is only one copy of the book in inventory. If the on-line bookstore application fails to update an inventory database to reflect sale of the book to the first customer before inventory is checked for the second customer's order, then the single book in inventory might be sold to both customers.
A number of concurrency isolation mechanisms for dealing with shared access problems in computer programs are known, including locks, semaphores, condition variables, barriers, joins, and like programming constructs that regulate concurrent access to program code and data. (See, e.g., Tucker Jr., Allen B. (editor), The Computer Science and Engineering Handbook, pp. 1662-1665, CRC Press 1997.) However, even with use of these concurrency isolation mechanisms, the task of programming a server application to deal with shared access problems is complex and difficult. Developers of server applications estimate that 30-40% of the development effort is spent on providing infrastructure, including for dealing with shared access problems, as opposed to implementing the business logic of the processing services that the server application is meant to provide. Further, concurrency isolation mechanisms are among the more sophisticated aspects of programming, and typically require the efforts of highly skilled programmers.
By contrast, applications on a single user computing platform are relatively much easier to program. The programmer need not account for shared access problems, and need not implement complex infrastructure to regulate access to code and data by multiple users. Programmers of single user applications thus can concentrate on implementing the "business logic" or data processing services of the application itself. As a result, programmers of single user applications can realize higher productivity, and do not require the added time and expense to acquire the skills necessary to work with sophisticated concurrency isolation mechanisms.
A programming model that is now commonly used in single user computing platforms is object-oriented programming (OOP). In object-oriented programming, programs are written as a collection of object classes which each model real world or abstract items by combining data to represent the item's properties with functions to represent the item's functionality. More specifically, an object is an instance of a programmer-defined type referred to as a class, which exhibits the characteristics of data encapsulation, polymorphism and inheritance. Data encapsulation refers to the combining of data (also referred to as properties of an object) with methods that operate on the data (also referred to as member functions of an object) into a unitary software component (i.e., the object), such that the object hides its internal composition, structure and operation and exposes its functionality to client programs that utilize the object only through one or more interfaces. An interface of the object is a group of semantically related member functions of the object. In other words, the client programs do not access the object's data directly, but must instead call functions on the object's interfaces to operate on the data.
Polymorphism refers to the ability to view (i.e., interact with) two similar objects through a common interface, thereby eliminating the need to differentiate between two objects. Inheritance refers to the derivation of different classes of objects from a base class, where the derived classes inherit the properties and characteristics of the base class.
Object-oriented programming generally has advantages in ease of programming, extensibility, reuse of code, and integration of software from different vendors and (in some object-oriented programming models) across programming languages. However, object-oriented programming in itself does not solve shared access problems in a multiple user computing system. Thus, when object-oriented programming techniques are used to program server applications, concurrency isolation mechanisms are still needed to regulate shared access of multiple users.
For example, a user of an object typically accomplishes processing work over multiple interactions with the object. First, the user calls member functions through interfaces of the object that set various data properties of the object (also referred to herein as the "data state" of the object). Then, the user calls one or more member functions to initiate processing based on the previously set data properties. If a second user accesses the object between a first user's interactions with the object, the second user can potentially alter the object's data state causing unintended consequences when the first user initiates processing based on the data state.
The present invention simplifies programming of server applications and increases the productivity of server application programmers by providing a multi-tier server application framework that limits access to object-oriented code of the server application to a single user. In the multi-tier framework, program code residing on the users' computers (such as for implementing user interface functions) forms a first tier. The business logic of the server application is implemented in single-user object-oriented code on a middle tier. Shared access program code such as that of a relational database is on a third tier.
By limiting object-oriented server application code to single user access, the multi-tier framework frees server application programmers from multiple user access concerns. The server application programmers can implement the business logic of the server application in a set of object classes, as if for a single user computing platform and without need for complex constructs to address multiple user access concerns. As a result, less programming effort is expended on application infrastructure unrelated to the core business logic of the application. In addition, programmers need not possess advanced or expert skills with mechanisms for regulating multiple user access to be able to program server applications within the multi-tier framework.
In accordance with an aspect of the invention, a run-time service and application integration interfaces provide an execution environment for objects on the server computer(s) that enforces the restriction on access to individual server application objects to just a single user. The run-time service includes object creation or instantiation code that associates each object at the time of its creation into a collection (termed an "activity"), which is exclusive or specific to only one user. The activity is an intrinsic property of the object that cannot be changed during its lifetime. Further, the run-time service tracks the flow of execution through each activity (e.g., calls to objects in the activity), preventing access to the activity by other users as well as any inadvertent parallelism which could corrupt the application state.
Accordingly, all object-oriented code in the server application is subject to the restriction against multiple user access. This further simplifies server application programming in that the programmer is ensured that all code written as objects in the server application will be limited to single user access and belongs on the middle tier of the architecture. Whereas, all non-object oriented code belongs to the third tier of the architecture and may be subject to access from multiple users.
Additionally, since the run-time service ensures exclusive access by a single user to the object-oriented server application code, any data processing that takes place in the object-oriented server application code is assured to be isolated from processing for other users. The programmer therefore is freed to implement business logic of the server application in object-oriented code without providing mechanisms to guard against interference from the server application's processing on other users' behalf.
Further, by allowing only a single logical thread of execution in the activity, the run-time server obviates any need to implement concurrency isolation between threads executing in the server application objects on behalf of even a single user.
Additional features and advantages of the invention will be made apparent from the following detailed description of an illustrated embodiment which proceeds with reference to the accompanying drawings.